package com.chen;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import com.netflix.hystrix.contrib.sample.stream.HystrixConfigSseServlet;
import com.netflix.ribbon.proxy.annotation.Hystrix;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
@EnableEurekaClient  //cs架构 客户端  在服务启动后自动注册到eureka中
@EnableDiscoveryClient//发现服务
public class DeptProvider_8001 {

    public static void main(String[] args) {
        SpringApplication.run(DeptProvider_8001.class,args);
    }

    //增加一个servlet  配合监控使用
    @Bean
    public ServletRegistrationBean HystrixConfigSseServlet(){
        ServletRegistrationBean registerBean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
        registerBean.addUrlMappings("/actuator/hystrix.stream");
        return registerBean;
    }


}
